package com.catsic;

import java.io.IOException;
import java.util.Properties;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

//import com.catsic.framework.exception.ServiceException;
import com.catsic.core.rmi.IssueServices;
import com.catsic.core.utils.CoreUtils;

public class RunServer {
    /**  
     * @param args  
     */  
	@SuppressWarnings("unused")
	public static void main(String[] args) {  
	       //初始化工作只能运行一次;运行多次的话，会启动多个服务  
		
		ApplicationContext context = new ClassPathXmlApplicationContext("classpath:config/spring/applicationContext*.xml"); 
		System.out.println("Spring 环境 已启动");

		try {
			//获取
			Properties props = CoreUtils.configerations();
			System.out.println("Server配置文件读取通过...");
			
			//启动各项分布式服务
			IssueServices is = new IssueServices();
			int isresult = is.IssueByConfige(context,props);
			System.out.println("RMI服务配置通过...。");
			
		} catch (IOException e) {
			System.out.println("Server配置文件读取失败...");
			e.printStackTrace();
		}
		

		System.out.println("Catsic服务器端已正常启动。"); 
	    
		System.out.println( context.getBean("organService").getClass().getName() );
		System.out.println( context.getBean("organServiceRMI").getClass().getName() );
	
	}

}
